package com.bbva.kyfb.kyfbjpatlbh.dominiotlbh;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Table;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.roo.addon.dbre.RooDbManaged;
import org.springframework.roo.addon.entity.RooEntity;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;
import org.springframework.transaction.annotation.Transactional;

/**
 * The Class Ttlsbppa.
 */
@Entity
@Table(name = "TTLSBPPA",schema = "TLSB")
@Configurable
@RooJavaBean
@RooToString
@RooEntity(identifierType = TtlsbppaPK.class, versionField = "",  persistenceUnit="persistenceUnitTLBH", table = "TTLSBPPA", schema = "TLSB")
@PersistenceContext(unitName="persistenceUnitTLBH")
@RooDbManaged(automaticallyDelete = true)
public class Ttlsbppa {

	/** The xsn firmable. */
	@Column(name = "XSN_FIRMABLE",columnDefinition = "CHAR", length=1)
	private Character xsnFirmable;

	/** The des urleje. */
	@Column(name = "DES_URLEJE",columnDefinition = "CHAR", length = 254)
	private String desUrleje;

	/** The des urldet. */
	@Column(name = "DES_URLDET",columnDefinition = "CHAR", length = 254)
	private String desUrldet;

	/** The des urlaud. */
	@Column(name = "DES_URLAUD",columnDefinition = "CHAR", length = 254)
	private String desUrlaud;

	/** The des objf. */
	@Column(name = "DES_OBJF",columnDefinition = "CHAR", length = 80)
	private String desObjf;

	/** The xsn msgavs. */
	@Column(name = "XSN_MSGAVS",columnDefinition = "CHAR", length = 1)
	private Character xsnMsgavs;

	/** The cod msgavs. */
	@Column(name = "COD_MSGAVS",columnDefinition = "CHAR", length = 3)
	private String codMsgavs;

	/** The xsn msgacp. */
	@Column(name = "XSN_MSGACP",columnDefinition = "CHAR", length = 1)
	private Character xsnMsgacp;

	/** The cod msgacp. */
	@Column(name = "COD_MSGACP",columnDefinition = "CHAR", length = 3)
	private String codMsgacp;

	/** The xsn fdsenv. */
	@Column(name = "XSN_FDSENV",columnDefinition = "CHAR", length = 1)
	private Character xsnFdsenv;

	/** The xsn fdsrec. */
	@Column(name = "XSN_FDSREC",columnDefinition = "CHAR", length = 1)
	private Character xsnFdsrec;

	/** The xsn trahis. */
	@Column(name = "XSN_TRAHIS",columnDefinition = "CHAR", length = 1)
	private Character xsnTrahis;

	/** The des trahis. */
	@Column(name = "DES_TRAHIS",columnDefinition = "CHAR", length = 100)
	private String desTrahis;

	
	
	/**
	 * @return the xsnFdsenv
	 */
	public Character getXsnFdsenv() {
		return xsnFdsenv;
	}

	/**
	 * @param xsnFdsenv the xsnFdsenv to set
	 */
	public void setXsnFdsenv(final Character xsnFdsenv) {
		this.xsnFdsenv = xsnFdsenv;
	}

	/**
	 * @return the xsnFdsrec
	 */
	public Character getXsnFdsrec() {
		return xsnFdsrec;
	}

	/**
	 * @param xsnFdsrec the xsnFdsrec to set
	 */
	public void setXsnFdsrec(final Character xsnFdsrec) {
		this.xsnFdsrec = xsnFdsrec;
	}

	/**
	 * @return the xsnTrahis
	 */
	public Character getXsnTrahis() {
		return xsnTrahis;
	}

	/**
	 * @param xsnTrahis the xsnTrahis to set
	 */
	public void setXsnTrahis(final Character xsnTrahis) {
		this.xsnTrahis = xsnTrahis;
	}

	/**
	 * @return the desTrahis
	 */
	public String getDesTrahis() {
		return desTrahis;
	}

	/**
	 * @param desTrahis the desTrahis to set
	 */
	public void setDesTrahis(final String desTrahis) {
		this.desTrahis = desTrahis;
	}

	/**
	 * Gets the xsn firmable.
	 *
	 * @return the xsn firmable
	 */
	public Character getXsnFirmable() {
		return this.xsnFirmable;
	}

	/**
	 * Sets the xsn firmable.
	 *
	 * @param xsnFirmable the new xsn firmable
	 */
	public void setXsnFirmable(final Character xsnFirmable) {
		this.xsnFirmable = xsnFirmable;
	}

	/**
	 * Gets the des urleje.
	 *
	 * @return the des urleje
	 */
	public String getDesUrleje() {
		return this.desUrleje;
	}

	/**
	 * Sets the des urleje.
	 *
	 * @param desUrleje the new des urleje
	 */
	public void setDesUrleje(final String desUrleje) {
		this.desUrleje = desUrleje;
	}

	/**
	 * Gets the des urldet.
	 *
	 * @return the des urldet
	 */
	public String getDesUrldet() {
		return this.desUrldet;
	}

	/**
	 * Sets the des urldet.
	 *
	 * @param desUrldet the new des urldet
	 */
	public void setDesUrldet(final String desUrldet) {
		this.desUrldet = desUrldet;
	}

	/**
	 * Gets the des urlaud.
	 *
	 * @return the des urlaud
	 */
	public String getDesUrlaud() {
		return this.desUrlaud;
	}

	/**
	 * Sets the des urlaud.
	 *
	 * @param desUrlaud the new des urlaud
	 */
	public void setDesUrlaud(final String desUrlaud) {
		this.desUrlaud = desUrlaud;
	}

	/**
	 * Gets the des objf.
	 *
	 * @return the des objf
	 */
	public String getDesObjf() {
		return this.desObjf;
	}

	/**
	 * Sets the des objf.
	 *
	 * @param desObjf the new des objf
	 */
	public void setDesObjf(final String desObjf) {
		this.desObjf = desObjf;
	}

	/**
	 * Gets the xsn msgavs.
	 *
	 * @return the xsn msgavs
	 */
	public Character getXsnMsgavs() {
		return this.xsnMsgavs;
	}

	/**
	 * Sets the xsn msgavs.
	 *
	 * @param desObjf the new xsn msgavs
	 */
	public void setXsnMsgavs(final Character xsnMsgavs) {
		this.xsnMsgavs = xsnMsgavs;
	}

	/**
	 * Gets the cod msgavs.
	 *
	 * @return the cod msgavs
	 */
	public String getCodMsgavs() {
		return this.codMsgavs;
	}

	/**
	 * Sets the cod msgavs.
	 *
	 * @param desObjf the new cod msgavs
	 */
	public void setCodMsgavs(final String codMsgavs) {
		this.codMsgavs = codMsgavs;
	}

	/**
	 * Gets the xsn msgacp.
	 *
	 * @return the xsn msgacp
	 */
	public Character getXsnMsgacp() {
		return this.xsnMsgacp;
	}

	/**
	 * Sets the xsn msgacp.
	 *
	 * @param desObjf the new xsn msgacp
	 */
	public void setXsnMsgacp(final Character xsnMsgacp) {
		this.xsnMsgacp = xsnMsgacp;
	}

	/**
	 * Gets the cod msgacp.
	 *
	 * @return the cod msgacp
	 */
	public String getCodMsgacp() {
		return this.codMsgacp;
	}

	/**
	 * Sets the cod msgacp.
	 *
	 * @param desObjf the new cod msgacp
	 */
	public void setCodMsgacp(final String codMsgacp) {
		this.codMsgacp = codMsgacp;
	}

	/** The entity manager. */
	@PersistenceContext
	transient EntityManager entityManager;

	/** The id. */
	@EmbeddedId
	private TtlsbppaPK id;

	/**
	 * Gets the id.
	 *
	 * @return the id
	 */
	public TtlsbppaPK getId() {
		return this.id;
	}

	/**
	 * Sets the id.
	 *
	 * @param id the new id
	 */
	public void setId(final TtlsbppaPK id) {
		this.id = id;
	}

	/**
	 * Persist.
	 */
	@Transactional(value="tlbh")
	public void persist() {
		if (this.entityManager == null) {
			this.entityManager = entityManager();
		}
		this.entityManager.persist(this);
	}

	/**
	 * Removes the.
	 */
	@Transactional(value="tlbh")
	public void remove() {
		if (this.entityManager == null) {
			this.entityManager = entityManager();
		}
		if (this.entityManager.contains(this)) {
			this.entityManager.remove(this);
		} else {
			final Ttlsbppa attached = Ttlsbppa.findTtlsbppa(this.id);
			this.entityManager.remove(attached);
		}
	}

	/**
	 * Flush.
	 */
	@Transactional(value="tlbh")
	public void flush() {
		if (this.entityManager == null) {
			this.entityManager = entityManager();
		}
		this.entityManager.flush();
	}

	/**
	 * Clear.
	 */
	@Transactional(value="tlbh")
	public void clear() {
		if (this.entityManager == null) {
			this.entityManager = entityManager();
		}
		this.entityManager.clear();
	}

	/**
	 * Merge.
	 *
	 * @return the ttlsbppa
	 */
	@Transactional(value="tlbh")
	public Ttlsbppa merge() {
		if (this.entityManager == null) {
			this.entityManager = entityManager();
		}
		final Ttlsbppa merged = this.entityManager.merge(this);
		this.entityManager.flush();
		return merged;
	}

	/**
	 * Entity manager.
	 *
	 * @return the entity manager
	 */
	public static final EntityManager entityManager() {
		final EntityManager em = new Ttlsbppa().entityManager;
		if (em == null) {
			throw new IllegalStateException("Entity manager has not been injected (is the Spring Aspects JAR configured as an AJC/AJDT aspects library?)");
		}
		return em;
	}


	/**
	 * Count ttlsbppas.
	 *
	 * @return the long
	 */
	@Transactional(value="tlbh")
	public static long countTtlsbppas() {
		return entityManager().createQuery("SELECT COUNT(o) FROM Ttlsbppa o", Long.class).getSingleResult();
	}


	/**
	 * Find all ttlsbppas.
	 *
	 * @return the list
	 */
	@Transactional(value="tlbh")
	public static List<Ttlsbppa> findAllTtlsbppas() {
		return entityManager().createQuery("SELECT o FROM Ttlsbppa o", Ttlsbppa.class).getResultList();
	}


	/**
	 * Find ttlsbppa.
	 *
	 * @param id the id
	 * @return the ttlsbppa
	 */
	@Transactional(value="tlbh")
	public static Ttlsbppa findTtlsbppa(final TtlsbppaPK id) {
		if (id == null) {
			return null;
		}
		return entityManager().find(Ttlsbppa.class, id);
	}


	/**
	 * Find ttlsbppa entries.
	 *
	 * @param firstResult the first result
	 * @param maxResults the max results
	 * @return the list
	 */
	@Transactional(value="tlbh")
	public static List<Ttlsbppa> findTtlsbppaEntries(final int firstResult, final int maxResults) {
		return entityManager().createQuery("SELECT o FROM Ttlsbppa o", Ttlsbppa.class).setFirstResult(firstResult).setMaxResults(maxResults).getResultList();
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		final StringBuilder sb = new StringBuilder();
		sb.append("DesUrlaud: ").append(getDesUrlaud()).append(", ");
		sb.append("DesUrldet: ").append(getDesUrldet()).append(", ");
		sb.append("DesUrleje: ").append(getDesUrleje()).append(", ");
		sb.append("DesObjf: ").append(getDesObjf()).append(", ");
		sb.append("Id: ").append(getId()).append(", ");
		sb.append("XsnMsgavs: ").append(getXsnMsgavs()).append(", ");
		sb.append("CodMsgavs: ").append(getCodMsgavs()).append(", ");
		sb.append("XsnMsgacp: ").append(getXsnMsgacp()).append(", ");
		sb.append("CodMsgacp: ").append(getCodMsgacp()).append(", ");
		sb.append("XsnFdsenv: ").append(getXsnFdsenv()).append(", ");
		sb.append("XsnFdsrec: ").append(getXsnFdsrec()).append(", ");
		sb.append("XsnTrahis: ").append(getXsnTrahis()).append(", ");
		sb.append("DesTrahis: ").append(getDesTrahis()).append(", ");
		sb.append("XsnFirmable: ").append(getXsnFirmable());
		return sb.toString();
	}
}
